#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Last Update:

'''docstring
'''

__revision__ = '0.1'
__author__ = 'lxd'

import logging

def getLogger(name):     
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)

    console = logging.StreamHandler()
    console.setLevel(logging.DEBUG)
    #console.setLevel(logging.INFO)

    file = logging.FileHandler('log.log', 'w')
    file.setLevel(logging.DEBUG)

    formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
    console.setFormatter(formatter)
    file.setFormatter(formatter)

    filter=logging.Filter(name)
    console.addFilter(filter)

    logger.addHandler(console)
    logger.addHandler(file)
    return logger   

if __name__ == '__main__':
    log = getLogger('lxd')
    log.error('its error')
    log.debug('its debug')

